/*     */ package com.newcrm.webapi;
/*     */ 
/*     */ import com.newcrm.bean.User;
/*     */ import com.newcrm.db.UserManager;
/*     */ import com.newcrm.exception.DBException;
/*     */ import com.newcrm.exception.NotFoundException;
/*     */ import com.newcrm.util.ParameterUtil;
/*     */ import com.newcrm.webapi.sub.ListCustomersName;
/*     */ import com.newcrm.webapi.sub.ShowContactCustomerNumFlow;
/*     */ import com.newcrm.webapi.sub.ShowCustomerCategoryChangeChartData;
/*     */ import com.newcrm.webapi.sub.ShowCustomerCategoryChangeChartData2;
/*     */ import com.newcrm.webapi.sub.ShowCustomerTagChartData;
/*     */ import com.newcrm.webapi.sub.ShowCustomerTypeChartData;
/*     */ import com.newcrm.webapi.sub.ShowDashboardCustomerNum;
/*     */ import java.io.IOException;
/*     */ import java.sql.SQLException;
/*     */ import javax.servlet.RequestDispatcher;
/*     */ import javax.servlet.ServletException;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ 
/*     */ public class Dashboard extends AbstractHttpServlet
/*     */ {
/*  28 */   private static Logger logger = Logger.getLogger(Dashboard.class.getName());
/*     */   private static final long serialVersionUID = -2202575462081556003L;
/*     */ 
/*     */   public void doGet(HttpServletRequest request, HttpServletResponse response)
/*     */     throws ServletException, IOException
/*     */   {
/*  56 */     if (!checkLogin(request)) {
/*  57 */       super.showLoginPage(request, response);
/*  58 */       return;
/*     */     }
/*  60 */     String url = request.getRequestURI();
/*  61 */     String[] param = ParameterUtil.getParameters(url, getTagkey());
/*     */ 
/*  63 */     if ((param == null) || (param.length == 0)) {
/*  64 */       User u = super.getLoginUser(request);
/*     */ 
/*  66 */       UserManager manager = new UserManager();
/*     */       try
/*     */       {
/*  69 */         String ids = manager.getExtInfoByType(u.userId, 
/*  70 */           3);
/*  71 */         request.setAttribute("viewCustomerIds", ids);
/*     */ 
/*  73 */         Integer loginNum = manager.getLoginNum(u.userId);
/*  74 */         request.setAttribute("loginNum", loginNum);
/*     */ 
/*  77 */         if ((loginNum != null) && (loginNum.intValue() == 1))
/*  78 */           manager.updateLoginNum(u.userId);
/*     */       }
/*     */       catch (DBException e) {
/*  81 */         logger.warn("get user view customerids failed", e);
/*     */       } catch (SQLException e) {
/*  83 */         logger.warn("get user view customerids failed", e);
/*     */       }
/*     */ 
/*  86 */       request.getRequestDispatcher("/dashboard.jsp").forward(request, 
/*  87 */         response);
/*  88 */       return;
/*     */     }
/*     */ 
/*  91 */     if (param.length == 1) {
/*  92 */       if ("customerName".equals(param[0])) {
/*  93 */         ListCustomersName action = new ListCustomersName(this);
/*     */         try {
/*  95 */           action.parse(request, response);
/*     */         } catch (NotFoundException e) {
/*  97 */           super.showErrorMessage(response, "");
/*     */         }
/*  99 */         return;
/*     */       }
/*     */ 
/* 102 */       if ("customerNum".equals(param[0])) {
/* 103 */         ShowDashboardCustomerNum action = new ShowDashboardCustomerNum(
/* 104 */           this);
/*     */         try {
/* 106 */           action.parse(request, response);
/*     */         } catch (NotFoundException e) {
/* 108 */           super.showErrorMessage(response, "");
/*     */         }
/* 110 */         return;
/*     */       }
/* 112 */       if ("sparkline".equals(param[0])) {
/* 113 */         ShowContactCustomerNumFlow action = new ShowContactCustomerNumFlow(
/* 114 */           this);
/*     */         try {
/* 116 */           action.parse(request, response);
/*     */         } catch (NotFoundException e) {
/* 118 */           super.showErrorMessage(response, "");
/*     */         }
/* 120 */         return;
/*     */       }
/*     */ 
/* 124 */       if ("chart".equals(param[0])) {
/* 125 */         ShowCustomerTypeChartData action = new ShowCustomerTypeChartData(
/* 126 */           this);
/*     */         try {
/* 128 */           action.parse(request, response);
/*     */         } catch (NotFoundException e) {
/* 130 */           super.showErrorMessage(response, "");
/*     */         }
/* 132 */         return;
/*     */       }
/*     */ 
/* 136 */       if ("categorychangechart".equals(param[0])) {
/* 137 */         ShowCustomerCategoryChangeChartData action = new ShowCustomerCategoryChangeChartData(
/* 138 */           this);
/*     */         try {
/* 140 */           action.parse(request, response);
/*     */         } catch (NotFoundException e) {
/* 142 */           super.showErrorMessage(response, "");
/*     */         }
/* 144 */         return;
/*     */       }
/*     */ 
/* 148 */       if ("categorychangechart2".equals(param[0])) {
/* 149 */         ShowCustomerCategoryChangeChartData2 action = new ShowCustomerCategoryChangeChartData2(
/* 150 */           this);
/*     */         try {
/* 152 */           action.parse(request, response);
/*     */         } catch (NotFoundException e) {
/* 154 */           super.showErrorMessage(response, "");
/*     */         }
/* 156 */         return;
/*     */       }
/*     */ 
/* 160 */       if ("tagchart".equals(param[0])) {
/* 161 */         ShowCustomerTagChartData action = new ShowCustomerTagChartData(
/* 162 */           this);
/*     */         try {
/* 164 */           action.parse(request, response);
/*     */         } catch (NotFoundException e) {
/* 166 */           super.showErrorMessage(response, "");
/*     */         }
/* 168 */         return;
/*     */       }
/*     */ 
/* 171 */       return;
/*     */     }
/*     */   }
/*     */ 
/*     */   protected AbstractAction getAddAction()
/*     */   {
/* 177 */     return null;
/*     */   }
/*     */ 
/*     */   protected AbstractAction getDeleteAction(String id)
/*     */   {
/* 182 */     return null;
/*     */   }
/*     */ 
/*     */   protected AbstractAction getListAction()
/*     */   {
/* 187 */     return null;
/*     */   }
/*     */ 
/*     */   protected AbstractAction getShowAction(String id)
/*     */   {
/* 192 */     return null;
/*     */   }
/*     */ 
/*     */   protected AbstractAction getShowAddPageAction()
/*     */   {
/* 197 */     return null;
/*     */   }
/*     */ 
/*     */   protected AbstractAction getShowConfirmDestroyAction(String id)
/*     */   {
/* 202 */     return null;
/*     */   }
/*     */ 
/*     */   protected AbstractAction getShowUpdatePageAction(String id)
/*     */   {
/* 207 */     return null;
/*     */   }
/*     */ 
/*     */   protected String getTagkey()
/*     */   {
/* 212 */     return "/dashboard";
/*     */   }
/*     */ 
/*     */   protected AbstractAction getUpdateAction(String id)
/*     */   {
/* 217 */     return null;
/*     */   }
/*     */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.Dashboard
 * JD-Core Version:    0.6.1
 */